import 'package:flutter/material.dart';
import 'package:qr_code_app/common/constant/color_config.dart';
import 'package:qr_code_app/module/login/bloc/login_bloc.dart';
import 'package:todo_flutter/todo_flutter.dart';

import 'widget/login_video_background_widget.dart';
import 'widget/login_widget.dart';

class LoginPage extends StatefulWidget {
  const LoginPage({Key? key}) : super(key: key);

  @override
  _LoginPageState createState() => _LoginPageState();
}

class _LoginPageState extends BaseState<LoginPage> {
  LoginBloc get bloc => getBloc<LoginBloc>();

  @override
  void initState() {
    super.initState();
    addBloc(LoginBloc());
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: GestureDetector(
        onTap: () {
          // 收起键盘
          FocusScope.of(context).unfocus();
        },
        child: Stack(
          alignment: Alignment.bottomCenter,
          children: [
            LoginVideoBackgroundWidget(),
            LoginWidget(bloc),
          ],
        ),
      ),
    );
  }
}
